#include <cstdio>
#include <cstring>
using namespace std;

#define STRING_LENGTH 55

int main()
{
    int num;
    scanf("%d", &num);
    char str1[STRING_LENGTH], 
        str2[STRING_LENGTH];
    int str1_len  = 0, str2_len = 0;
    for (int i = 0; i < num; i++) {
        scanf("%s %s", str1, str2);
        str1_len = strlen(str1);
        str2_len = strlen(str2);
        if (str1_len == str2_len) {
            printf("%s is equal long to %s\n", str1, str2);
        } else if (str1_len >= str2_len) {
            printf("%s is longer than %s\n", str1, str2);
        } else {
            printf("%s is shorter than %s\n", str1, str2);
        }        
    }
}